Skip to main content

identity

Identity(input: Integer) : Mat

param input - the size of the identity matrix you want to create. An identity matrix is square, so itll be the length of the rows and columns.

returns: Mat - A Mat 2d array namely the identity matrix.

This function creates a identity matrix. An identity matrix is simply a square matrix, whose diagonal entries are all 1's and everything else is 0's. It is important because any matrix multiplied by the identity matrix (to the left, or right) gives back that matrix.